]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appDisplay: Introduce moveItem API
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Tue, 26 May 2020 13:58:56 +0000 (10:58 -0300)
committerFlorian Müllner <florian.muellner@gmail.com>
Mon, 20 Jul 2020 16:13:19 +0000 (16:13 +0000)
This is a simplistic API that basically removes the
icon from it's old location, and adds it to its new
location.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1284

js/ui/appDisplay.js

index 6ae3f0eb5a3f544462334fac6c6640c699ce15fb..cbc098082431aa49912b178442d9dbc336556b4c 100644 (file)
@@ -456,6 +456,17 @@ var BaseAppView = GObject.registerClass({
         return [targetPage, targetPosition, dragLocation];
     }
 
+    _moveItem(item, newPage, newPosition) {
+        const [page, position] = this._grid.getItemPosition(item);
+        if (page === newPage && position === newPosition)
+            return;
+
+        if (page !== -1 && position !== -1)
+            this._removeItem(item);
+
+        this._addItem(item, newPage, newPosition);
+    }
+
     vfunc_allocate(box) {
         const width = box.get_width();
         const height = box.get_height();